home *** CD-ROM | disk | FTP | other *** search
/ The Original Shareware 1.1 / The Original Shareware (WeMake CDs)(Volume 1.1)(CDs, Inc)(1993).iso / 6 / hanson.zip / INDE.C < prev    next >
Text File  |  1985-12-31  |  640b  |  35 lines

  1. /* index and xindex for translit, and other programs */
  2.  
  3. /* find index of char c in string str */
  4.  
  5. index(str,c)
  6. char c;
  7. char str[];
  8. {
  9.     int ind;
  10.  
  11.     for(ind = 0; str[ind] != EOS ; ++ind)
  12.         if(str[ind] == c)
  13.             return(ind);
  14.     return(-1);
  15. }
  16.  
  17.  
  18. /* handle index specially for translit */
  19. xindex(arr,c,allbut,lastto)
  20. int c;
  21. char arr[];
  22. int allbut,lastto;
  23. {
  24.     int index();
  25.     
  26.     if(c == EOF)
  27.         return(-1);
  28.     else if(allbut == NO)
  29.         return(index(arr,(char) c));
  30.     else if(index(arr,(char) c)>-1)
  31.         return(-1);
  32.     else 
  33.         return(lastto + 1);
  34. }
  35.